package a_Map;

import java.util.HashMap;
import java.util.Map;
import java.util.Set;

/**
 * @author Cheng-02
 * @version V1.0
 * @Package a_Map
 * @date 2024/4/11 下午5:53
 */
public class Test04 {
    public static void main(String[] args) {
        HashMap<Person, String> map = new HashMap<>();
        map.put(new Person("张三", 18), "北京");
        map.put(new Person("李四", 20), "上海");
        map.put(new Person("张三", 22), "广州");
        System.out.println(map);

        Set<Map.Entry<Person, String>> entries = map.entrySet();
        for (Map.Entry<Person, String> entry : entries) {
            System.out.println(entry.getKey() + " :" + entry.getValue());
        }
    }
}
